# stdlogo

A Simple Logo Standardizer Bash Script with Imagemagick

This script standardize the size of brand logos in different formats, shapes and sizes with adding whitespace to them. 


## Requirements

This script use Imagemagick, awk and mktemp.


## Usage
`./stdlogo.sh <source_path> <target_path>`

Default output is 400x230. Supported logo extensions are .png, .jpg and .svg.  You can change configuration parameters in script for advanced usecases. 

## Parameters

**OUTPUT_BACKGROUND:** Output image background color. Opacity not supported yet but can easily added.

**OUTPUT_SIZE:** Output image wxh size in pixel.

**LOGO_TRIM_FUZZ:** Trim whitespace color fuzz value in percent. Useful when work with low quality JPEGs. 

**LOGO_HEIGHT_TOLERANCE:** Logo height tolerance in pixel. If resized logo height smaller than height + 
tolerance, logo will resize to desired height, otherwise logo will resize to desired width. 

**LOGO_DESIRED_HEIGHT:** Desired logo height in output image.

**LOGO_DESIRED_WIDTH:** Desired logo width in output image.

## Limitations

* Script won't remove background color for you. For logos with solid background, change background color to *OUTPUT_BACKGROUND* or use [remove.bg](https://www.remove.bg/) like services. 
* Script use *trim* functionality of imagemagick to remove excessive whitespace from logo. This cause deformations in logo has solid background.  [Example logo](https://www.barco.com/Content/images/barco-logo-web.png) 
* High *LOGO_TRIM_FUZZ* values may cause deformations in logos.   
* Script won't change logo colors for you to fit *OUTPUT_BACKGROUND*. You had to do this.
